import {legacy_createStore as createStore,applyMiddleware} from 'redux';
import logger from 'redux-logger';
import thunk from 'redux-thunk';
import promise from 'redux-promise';
import rootReducer from './reducers';
import {routerMiddleware,createReduxHistory} from '../history';
//创建仓库，应用中间件
const store = applyMiddleware(
    //routerMiddleware可以检测跳转路径的action{type:'@@router/CHANGE_LOCATION',payload:'/counter'};
    //会进行路径跳转
    routerMiddleware,promise,thunk,logger
    )(createStore)(rootReducer)
//根据仓库创建redux优先的history对象
const history = createReduxHistory(store);
export {
    store,
    history
}